package com.demo.designmode.proxy.dynamic.jdk1;

import java.lang.reflect.Proxy;

/**
 * @Author: jxm
 * @Description:
 * @Date: 2024-1-11 11:31
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        // 创建一个真实主题对象
        RealSubject realSubject = new RealSubject();
        // 创建一个日志处理器对象，并传入真实主题对象
        LogHandler logHandler = new LogHandler(realSubject);
        Subject instance = (Subject)Proxy.newProxyInstance(realSubject.getClass().getClassLoader(),
                realSubject.getClass().getInterfaces(),
                logHandler);
        instance.request();
    }
}
